package com.youngjun.common.exception;

/**
 * @author VirgoJun
 */
public class CommonExceptionType {

    //数据库异常
    public static final CommonExceptionType DB_INSERT_FAILED = CommonExceptionType.of(1001, "插入数据失败.");
    public static final CommonExceptionType DB_UPDATE_FAILED = CommonExceptionType.of(1002, "更新数据失败.");
    public static final CommonExceptionType DB_DELETE_FAILED = CommonExceptionType.of(1003, "删除数据失败.");
    public static final CommonExceptionType DB_PAGE_FAILED = CommonExceptionType.of(1004, "分页数据失败.");

    //OSS异常
    public static final CommonExceptionType OSS_INSERT_FAILED = CommonExceptionType.of(2001, "文件保存失败.");
    public static final CommonExceptionType OSS_GET_FAILED = CommonExceptionType.of(2002, "文件获取失败.");
    public static final CommonExceptionType OSS_REMOVE_FAILED = CommonExceptionType.of(2003, "文件删除失败.");

    private int code;

    private String message;

    private CommonExceptionType() {
    }

    private CommonExceptionType(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private static CommonExceptionType of(int code, String message) {
        return new CommonExceptionType(code, message);
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
